function Q = proximity_quotient(sc, st, F, mu, W)

pp = sc(1);
ff = sc(2);
gg = sc(3);
hh = sc(4);
kk = sc(5);
LL = sc(6);

pp_t = st(1);
ff_t = st(2);
gg_t = st(3);
hh_t = st(4);
kk_t = st(5);

aa   = pp / (1 - ff^2 - gg^2);         % semi-major axis for chaser
aa_t = pp_t / (1 - ff_t^2 - gg_t^2);   % semi-major axis for target
ecc = sqrt(ff^2+gg^2);
q   = 1 + ff*cos(LL) + gg*sin(LL);
s2  = 1 + hh^2 + kk^2;               % angular momentum magnitude
r_p = aa * ( 1 - ecc );              % osculating periapsis radius

%% distance function
da = aa - aa_t;
df = ff - ff_t;
dg = gg - gg_t;
dh = hh - hh_t;
dk = kk - kk_t;

%% maximum rates of change of the orbit elements
dadtxx = 2 * F * aa * sqrt(aa/mu) * sqrt( ( 1+sqrt(ff^2+gg^2) ) / ( 1-sqrt(ff^2+gg^2) ) );
dfdtxx = 2 * F * sqrt(pp/mu);
dgdtxx = 2 * F * sqrt(pp/mu);
dhdtxx = 0.5 * F * sqrt(pp/mu) * s2 / ( sqrt(1-gg^2)+ff );
dkdtxx = 0.5 * F * sqrt(pp/mu) * s2 / ( sqrt(1-ff^2)+gg );

%% Q definition
Qa = (da/dadtxx)^2;
Qf = (df/dfdtxx)^2;
Qg = (dg/dgdtxx)^2;
Qh = (dh/dhdtxx)^2;
Qk = (dk/dkdtxx)^2;

Wa = W(1);
Wf = W(2);
Wg = W(3);
Wh = W(4);
Wk = W(5);

Q = Wa*Qa + Wf*Qf + Wg*Qg + Wh*Qh + Wk*Qk;
Q = real(Q);